package sung;

public class FindNumber {
	
	int[] numberList = {34, 26, 98, 76, 32, 15, 56, 24, 5, 7, 14};
	
	public void findUserReqNO(int userReqNO){
		
		int findNO = 999;
		int tempValue = 999;
		
		for(int i=0;i<numberList.length;i++){
			
			int checkVal = (numberList[i] - userReqNO < 0) ? -(numberList[i] - userReqNO) : numberList[i] - userReqNO;
			if(checkVal < tempValue){
				findNO = numberList[i];
				tempValue = checkVal;
			}
		}
		System.out.println("result findNO="+findNO+" / tempValue="+tempValue);
	}
	
	public static void main(String[] args) {
		FindNumber findNO = new FindNumber();
		findNO.findUserReqNO(6);
	}
}